//
//  RegionCell.m
//  PHMall
//
//  Created by admin on 2018/5/11.
//  Copyright © 2018年 admin. All rights reserved.
//

#import "RegionCell.h"

@implementation RegionCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
+ (instancetype)theShareCellWithTableView:(UITableView *)tableView{
    
    static NSString *ID = @"SetCell";
    RegionCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[RegionCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
        cell.selectionStyle=UITableViewCellSelectionStyleNone;;
    }
    cell.backgroundColor=[UIColor whiteColor];
    return cell;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
    
        self.name=[[UILabel alloc]init];
        self.name.text=@"中国";
        self.name.font=[UIFont systemFontOfSize:18];
        self.name.numberOfLines=2;
        [self.contentView addSubview:self.name];
        
        self.code=[[UILabel alloc]init];
        self.code.text=@"+86";
        //        self.specification.numberOfLines=2;
        self.code.font=[UIFont systemFontOfSize:15];
        self.code.textColor=[UIColor colorWithHexString:@"#BFC3C4"];
        [self.contentView addSubview:self.code];
        
        self.line=[UIView new];
        self.line.backgroundColor=[UIColor groupTableViewBackgroundColor];
        [self.contentView  addSubview:self.line];
        
    }
    return self;
}
-(void)layoutSubviews{
    [super layoutSubviews];
    CGSize superSize = self.contentView.frame.size;
    
    if (CGSizeEqualToSize(superSize, CGSizeZero)) {
        return;
    }

    [self.name mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(20);
        make.centerY.offset(0);
    }];
    
    [self.code mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.offset(-20);
        make.centerY.offset(0);
    }];
    
    [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.offset(0);
        make.left.right.offset(0);
        make.height.mas_equalTo(1);
    }];
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
